package com.group9.handinhand.dao.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name = "COMMUNITY_CATEGORY")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CommunityCategory extends AbstractBaseModel {

	private static final long serialVersionUID = 1L;
	
	@Column(name = "NAME", nullable = false)
	private String name;
	
	@ManyToOne
	@JoinColumn(name = "PARENT_CATEGORY_ID")
	private CommunityCategory parentCategory;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public CommunityCategory getParentCategory() {
		return parentCategory;
	}

	public void setParentCategory(CommunityCategory parentCategory) {
		this.parentCategory = parentCategory;
	}

	@Override
	public String toString() {
		return "CommunityCategory [name=" + name + ", parentCategory="
				+ parentCategory + "]";
	}	

}
